function reconstructMatrix(upper: number, lower: number, colsum: number[]): number[][] {
    const arr: number[][] = new Array(2).fill(0).map(item => new Array(colsum.length).fill(0))
    const sum: number = colsum.reduce((sum,item) => sum += item,0)
    if(sum !== upper + lower) {
        return []
    }
    const nullArr: number[] = [] // 存放未明确的index位置
    colsum.forEach((item,index) => {
        if(item === 0){
            arr[0][index] = arr[1][index] = 0
        }else if(item === 2){
            arr[0][index] = arr[1][index] = 1
        }else {
            nullArr.push(index)
        }
    })
    const sumSingal: number = arr[0].reduce((sum,item) => sum += item,0)
    if (sumSingal > upper || sumSingal > lower) {
        return []
    }else {
        const num = upper - sumSingal
        nullArr.forEach((item,index) => {
            if(index < num){
                arr[0][item] = 1
            }else {
                arr[1][item] = 1
            }
        })
    }
    return arr
};



const upper: number = 5
const lower: number = 5
const colsum: number[] = [2,1,2,0,1,0,1,2,0,1]
console.log(reconstructMatrix(upper,lower,colsum ))